
package playground;

import cfar.ff.fun.F1;
import fj.data.List;
import fj.control.parallel.Strategy;
import java.util.Timer;
import static fj.data.List.*;
import static fj.control.parallel.Strategy.*;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author badi
 */
public class map implements Runnable{

    public static void main(String[] args){
        new map().run();
    }

    public  void run() {
        List l = list(0,1,2,3,4,5,6,7,8,9);

        F1 f = new F1<Integer, Integer>() {

            public Integer f(Integer a) {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException ex) {
                    Logger.getLogger(map.class.getName()).log(Level.SEVERE, null, ex);
                }
                return a + 10;
            }
        };
        
        for(Object o : simpleThreadStrategy().parMap1(f, l))
            System.out.print(o + " ");
        System.out.println();
        
    }
}
